import { RootState } from "../utils/store.type";
import { Module } from "vuex";

const aircraftStatus: Module<any, RootState> = {
	namespaced: true,
	state: () => ({
		aircraftAltitude: 0,
		aircraftBaseHeadDirection: "",
		aircraftDownLinkSignal: 0,
		aircraftFlyInSecond: 0,
		aircraftGoHomeHeight: "",
		aircraftHSpeed: 0,
		aircraftHeadDirection: "",
		aircraftLocationLatitude: "",
		aircraftLocationLongitude: "",
		aircraftPitch: "",
		aircraftRoll: "",
		aircraftUpLinkSignal: 0,
		aircraftVSpeed: "",
		aircraftVideoSignal: "",
		aircraftYaw: "",
		areMotorsOn: false,
		diagnostics: [],
		flightMode: "GPS_ATTI",
		goHomeState: "UNKNOWN",
		homeAltitude: "",
		homeLocationLatitude: "",
		homeLocationLongitude: "",
		isCompassError: false,
		isVisionPrecisionLanding: false,
		satelliteCount: "",
		ultrasonicHeightInMeters: "",
	}),

	mutations: {
		statusUpdate(state, payload) {
			// console.log(state,payload);
			const json = JSON.parse(payload);
			Object.assign(state, json);
		},
	},

};

export 	default aircraftStatus;
